//
//  CoreDataHandle.h
//  CoreDataExercise
//
//  Created by Bang-guo on 15/7/10.
//  Copyright (c) 2015年 guobang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "NearbyDetailCDM.h"

@interface CoreDataHandle : NSObject

+(CoreDataHandle *)shareCoreData;
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;

- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;


//photo ;
//name ;
//rating ;
//recommended_reason ;
//address ;
//arrival_type ;
//opening_time ;
//tel ;
//placeId ;
//descriptionP;
//type;
//lat ;
//lng ;
-(void)insert:(NSString *)entityName withPhoto:(NSString *)photo withName:(NSString *)name withRating:(NSString *)rating withRecommended_reason:(NSString *)recommended_reason withAddress:(NSString *)address withArrival_type:(NSString *)arrival_type withOpening_time:(NSString *)opening_time withTel:(NSString *)tel withPlaceId:(NSString *)placeId withDescriptionP:(NSString *)descriptionP withType:(NSString *)type withLat:(NSString *)lat withLng:(NSString *)lng;




-(NSArray *)select:(NSString *)entityName withKey:(NSString *)key withValue:(id)value withSort:(NSString *)sort;


-(NSArray *)selectAll:(NSString *)entityName;

-(void)deleteData:(NSString *)entityName withKey:(NSString *)key withValue:(id)value;

//-(void)updata:(NSString *)entityName withKey:(NSString *)key withValue:(id)value withModle:(Person *)person;

@end
